package com.wc.AlgoOJ.DS0103;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * @Author congege
 * @Description 数字统计
 * http://43.138.190.70:8888/p/DS0103
 * @Date Created in 2023/12/23-15:39
 */
public class Main {
    static int maxN = (int) 1e5;
    static int[] array = new int[maxN];
    static FastReader in = new FastReader();

    public static void main(String[] args) {
        int n = in.nextInt();
        int[] ansArr = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = in.nextInt();
            ansArr[i] = i - 1 - halfSearch(0, i - 1, array[i] - 5);
        }
        StringBuffer ans = new StringBuffer();
        ans.append(ansArr[0]);
        for (int i = 1; i < n; i++) {
            ans.append(' ');
            ans.append(ansArr[i]);
        }
        System.out.println(ans);
    }

    static int halfSearch(int l, int r, int val) {
        int mid;
        while (l <= r) {
            mid = l + (r - l) / 2;
            if (array[mid] >= val) {
                r = mid - 1;
            } else {
                l = mid + 1;
            }
        }

        return l - 1;
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }
}
